package win.smartown.android.app.richtexteditor;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.google.gson.Gson;

import java.util.ArrayList;
import java.util.List;

import win.smartown.android.library.richtexteditor.Content;
import win.smartown.android.library.richtexteditor.RichTextPreview;

public class PreviewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_preview);
        RichTextPreview richTextPreview = findViewById(R.id.preview);
        List<Content> contents = new ArrayList<Content>() {
            @Override
            public String toString() {
                return super.toString();
            }
        };
        contents = new Gson().fromJson(getIntent().getStringExtra("content"), contents.getClass().getGenericSuperclass());
        richTextPreview.showContent(contents);
    }

}
